<?php
/* Is User Owner of Page */
if(is_user_logged_in()){
  $deal_slug = pods_url_variable('last');
  $deal = new Pod('deal', $deal_slug);
  $user_slug = $deal->get_field('added_by_user.slug');
  $is_owner_of_deal = is_deal_owner($user_slug);
}
/* Is User Owner of Page */
?>

<style>
.name .comment, .brand_name_pf .comment, .short .comment, .deal_address .comment, .image .comment, .camp_end .comment, .latlng .comment{  
  line-height: 16px;
  text-align: justify;
  width: 390px;
}

.clear{
height: 2px !important;
}

.pods_form .leftside, .pods_form .rightside {
float: none !important;
}

.form_1{
position: relative !important;
}

.camp_cat label{
position: absolute; top: 0px; right: 170px;
}

.camp_cat select{
position: absolute; top: 58px; right: 135px;
}

.camp_cat .comment{
line-height: 16px;position: absolute;right: 33px;text-align: justify;top: 25px;width: 300px;
}

.city label{
position: absolute; top: 85px; right: 86px; width: 200px !important;
}

.city .comment{
position: absolute; top: 105px; right: 95px;
}

#pods_form1_city{
position: absolute; top: 130px; right: 0px;
}

.tag_pick label{
position: absolute; top: 300px; right: 172px;
}

#pods_form1_tag_pick{
position: absolute; top: 330px; right: 0px;
}
.terms label{
position: absolute; top: 495px; right: 172px;
}
.terms .comment{
line-height: 16px;position: absolute;right: 35px;top: 525px;width: 300px;
}

#pods_form1_terms{
position: absolute; top: 560px; right: 0px;
}

.terms textarea{
width: 42% !important;
}

.deal_address textarea, .short textarea{
width: 68% !important;
}

.terms textarea{
position: absolute;
right: 0;
top: 634px;
}

.form_1 .pick {
width:42% !important;
}

.add_offer{
  margin: 0px auto;
  background-color: #FFFFFF;
  width: 800px;
  color: #000000;
  padding: 30px; 
}

.add_offer label{
  width: 115px;
  margin-right: 50px;
  margin-bottom: 10px;
}

.add_offer input, .add_offer textarea, .add_offer select{
  margin-bottom: 10px;
}

.asteric{
font-weight: bold;
color: red;
font-size: 19px;
}

.blue_text{
color: skyblue;
font-weight: bold;
font-size: 15px;
}
.expires
{
  margin-left: 10px;
}

#ui-datepicker-div{
width: 20% !important;
height: 255px !important;
}

#main{
background: none !important;
}

.login_info{
text-align:center;
color: lightSkyBlue;
}

.login_info h3{
padding: 0px !important;
}

.center_align{
text-align:center;
}

.add_offer h2, .add_offer h3{
padding: 0px;
}

.add_offer h3{
font-style: normal;
font-size: 12px;
color: red;
}

.add_offer h3 a{
color: Lime;
font-weight: bold;
}

.add_offer h3 a:visited{
color: grey;
}

.comment{
color: lightSkyBlue !important;
clear: both;
}

.pods_form .option {
color: black !important;
}
</style>

<?php
if(!is_user_logged_in()){
echo '<div class="add_offer" style="height:30px !important;"><div class="login_info"><h3><a rel="nofollow" href="/wp-login.php" class="simplemodal-login" title="Edit Offer">Please Login to Edit the Offer!</a></h3></div></div>';
}else{

if($is_owner_of_deal == 1){
?>

<div class="add_offer">
<div class="center_align"><h2>Edit Offer</h2></div>
<?php
$user_id = get_buzzr_users_pod_id();
$fields = array('name','camp_link'=>array('hidden' => true),'short','deal_address', 'image'=>array('input_helper' => 'input_upload_single_photo'),'camp_end'=>array('input_helper' => ''),'latlng', 'camp_cat'=>array('input_helper'=>'add_offer_local_cat'),'city','tag_pick','terms','sale'=>array('default' => 'active', 'hidden' =>true),'added_by_user'=>array('default' => $user_id, 'hidden' =>true));
echo $deal->publicForm($fields, 'Edit Offer');
?>

</div>

<?php 
}else{
echo '<div class="add_offer" style="height:30px !important;"><div class="login_info"><h3><a rel="nofollow" href="#" title="Not Permitted">You are not permitted to edit this offer!</a></h3></div></div>';
}

}
?>
<div class="clear"></div>